//
//  JXCalendarYearHeaderView.m
//  TestCollectionView
//
//  Created by Lemon on 2019/4/20.
//  Copyright © 2019 sunshinfight@163.com. All rights reserved.
//

#import "JXCalendarYearHeaderView.h"

@implementation JXCalendarYearHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initUI];
    }
    return self;
}

- (void)initUI
{
    [self addSubview: self.yearLabel];
    self.yearLabel.translatesAutoresizingMaskIntoConstraints = NO;
//    [self.yearLabel.leftAnchor constraintEqualToAnchor:self.leftAnchor];
//    [self.yearLabel.rightAnchor constraintEqualToAnchor:self.rightAnchor];
//    [self.yearLabel.topAnchor constraintEqualToAnchor:self.topAnchor];
//    [self.yearLabel.bottomAnchor constraintEqualToAnchor:self.bottomAnchor];
}

- (UILabel *)yearLabel
{
    if (_yearLabel == nil) {
        _yearLabel = [UILabel new];
        _yearLabel.backgroundColor = UIColor.whiteColor;
        _yearLabel.font = [UIFont boldSystemFontOfSize:22];
    }
    return _yearLabel;
}

//- (void)layoutSubviews
//{
//    [super layoutSubviews];
//    _yearLabel.center = self.center;
//}

- (void)configUIWithModel: (JXCalendarModel*)model
{
    self.yearLabel.text = [NSString stringWithFormat:@"%d年", model.year];
}

@end
